package com.kitty.game.gm;

import com.kitty.common.utils.SpringUtils;
import com.kitty.common.start.GameServer;
import com.kitty.common.start.MyApplicationRunner;
import com.kitty.cross.CrossServerConfig;
import com.kitty.cross.login.service.CrossService;
import com.kitty.cross.login.service.PlayerNativeTransferService;
import com.kitty.game.base.service.BagService;
import com.kitty.game.config.SpecialItem;
import com.kitty.game.enter.FiedValue;
import com.kitty.game.enter.TitleInfo;
import com.kitty.game.equip.handler.EquipHunQiFenHuaHandler;
import com.kitty.game.equip.message.RespFlyInfo;
import com.kitty.game.equip.message.RespNotifyMiscEx;
import com.kitty.game.equip.model.EquipField;
import com.kitty.game.equip.model.RoleEquip;
import com.kitty.game.equip.model.RoleEquipField;
import com.kitty.game.equip.service.EquipService;
import com.kitty.game.equip.service.FabaoService;
import com.kitty.game.fight.bean.Fight;
import com.kitty.game.fight.service.FightService;
//import com.kitty.game.fly.RespFlyArtifactMake;
import com.kitty.game.hunqiao.HunQiaoService;
import com.kitty.game.hunqiao.enums.HunQiaoColorEnum;
import com.kitty.game.hunqiao.message.HunQiaoCangKu;
import com.kitty.game.hunqiao.model.HunQiaoField;
import com.kitty.game.hunqiao.model.HunQiaoStoreEquipInfo;
import com.kitty.game.hunqiao.model.HunQiaoToSave;
import com.kitty.game.identity.IdentityType;
import com.kitty.game.onlinemall.MallDataPool;
import com.kitty.game.party.model.Party;
import com.kitty.game.party.service.PartyService;
import com.kitty.game.pay.model.PayNotifyInfo;
import com.kitty.game.pay.service.OrderService;
import com.kitty.game.pet.PetDataPool;
import com.kitty.game.pet.bean.PetObject;
import com.kitty.game.pet.model.Pet;
import com.kitty.game.pet.service.PetService;
import com.kitty.game.role.model.Account;
import com.kitty.game.role.model.Role;
import com.kitty.game.role.service.AccountService;
import com.kitty.game.role.service.PayService;
import com.kitty.game.role.service.RoleService;
import com.kitty.game.team.message.RespMsg;
import com.kitty.listener.EventDispatcher;
import com.kitty.listener.EventType;
import com.kitty.listener.event.RoleNameChangeEvent;
import com.kitty.common.model.Reason;
import com.kitty.mina.cache.DataCache;
import com.kitty.mina.cache.SessionUtils;
import com.kitty.mina.message.MessagePusher;
import lombok.extern.slf4j.Slf4j;
import org.apache.mina.core.session.IoSession;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.lang.random.R;
import org.springframework.stereotype.Service;

import java.util.*;

@Service
@Slf4j
public class GmCommandHandler {

    public void startShidao(Role role, String content) {
        String[] strings = content.split("##");
//        SpringUtils.getBean(ShiDaoHandler.class).setStartH(Integer.parseInt(strings[0]));
//        SpringUtils.getBean(ShiDaoHandler.class).setStartM(Integer.parseInt(strings[1]));
//        SpringUtils.getBean(ShiDaoHandler.class).prepareOnceShiDao();
    }

    public void fabao18ji(Role role, String content) {
        int xiangxin = 0;
        if (content.contains("(金)")) {
            xiangxin = 1;
        } else if (content.contains("(木)")) {
            xiangxin = 2;
        } else if (content.contains("(水)")) {
            xiangxin = 3;
        } else if (content.contains("(火)")) {
            xiangxin = 4;
        } else if (content.contains("(土)")) {
            xiangxin = 5;
        }
        String equipname = content.substring(3, content.indexOf("("));
        SpringUtils.getBean(FabaoService.class).getArtifact18(role, equipname, xiangxin);
    }

    public void fabao24ji(Role role, String content) {
        int xiangxin = 0;
        if (content.contains("(金)")) {
            xiangxin = 1;
        } else if (content.contains("(木)")) {
            xiangxin = 2;
        } else if (content.contains("(水)")) {
            xiangxin = 3;
        } else if (content.contains("(火)")) {
            xiangxin = 4;
        } else if (content.contains("(土)")) {
            xiangxin = 5;
        }
        String equipname = content.substring(3, content.indexOf("("));
        SpringUtils.getBean(FabaoService.class).getArtifact24(role, equipname, xiangxin);
    }

    public void chongzhi(Role role, String content) {
        String[] strings = content.split("##");
        PayNotifyInfo payNotifyInfo = new PayNotifyInfo();
        payNotifyInfo.setMoney(Integer.parseInt(strings[0]));
        payNotifyInfo.setTradeNo("MY-"+R.UU32());
        payNotifyInfo.setAccount(role.getSid());
        payNotifyInfo.setRoleUid(role.getUid());
        payNotifyInfo.setGold(Integer.parseInt(strings[1]));
        payNotifyInfo.setCreateTime(new Date());
        SpringUtils.getBean(OrderService.class).handleOrder(payNotifyInfo);

    }

    public void chenghao(Role role, String content) {
        TitleInfo titleInfo = new TitleInfo();
        titleInfo.setType(content);
        titleInfo.setTitle(content);
        SpringUtils.getRoleService().addTitle(role, titleInfo);
    }


    public void level(Role role, int level) {
        SpringUtils.getBean(GmService.class).level(role,level);
    }

    public void money(Role role, int money) {
        SpringUtils.getRoleService().addMoney(role, money, Reason.GM_ADD_MONEY);
    }


    public void exp(Role role, int money) {
        SpringUtils.getRoleService().addExp(role, money, 1, role.getPetBox().getFightPetId());
    }

    public void pot(Role role, int pot) {
        SpringUtils.getRoleService().addPot(role, pot);
    }

    public void matiral(Role role, int matiral) {
        Pet pet = role.getPetBox().getPetByPetId(role.getPetBox().getFightPetId());
        SpringUtils.getRoleService().addPetMatiral(role, pet, matiral);
    }

    public void gold(Role role, int money) {
        SpringUtils.getRoleService().addGold(role, money, Reason.GM_ADD_GOLD);
        SpringUtils.getRoleService().updateRoleGoldAndSiver(role);
    }

    public void name(Role aaa, String content) {
        content = content.trim();
        String[] strings = content.split("##");
        Role temp = SpringUtils.getBean(Dao.class).fetch(Role.class, Cnd.where("roleId", "=", Integer.parseInt(strings[0])));
        if (temp == null) {
            return;
        }
        temp.doAfterInit();
        // 内存中是否有这个角色
        Role role = SpringUtils.getPlayerService().getPlayerBy(temp.getUid());
        if (role != null){
            temp = role;
        }
        String oldName = temp.getName();
//        Set<String> nameList = temp.getExtendBox().getNameList();
//        nameList.add(oldName);
        temp.setName(strings[1]);
        temp.save();
        // 让玩家重上
        SpringUtils.getPlayerService().updateRoleName(oldName, temp);
//        SpringUtils.getRoleService().modifyName(temp, strings[1]);
        EventDispatcher.getInstance().fireEvent(new RoleNameChangeEvent(EventType.ROLE_NAME_CHANGE, temp, oldName, strings[1]));

        IoSession session = SessionUtils.getSessionBy(temp.getUid());
        if (session != null){
            session.closeNow();
        }
    }

    public void shuxin(Role role, int money) {
        role.setStr((short) money);
        role.setCon((short) money);
        role.setWiz((short) money);
        role.setDex((short) money);
        SpringUtils.getBean(RoleService.class).sendExtraAttribute(role);
    }

    public void pet(Role role, String petName) {
        PetObject petObject = PetDataPool.getPetObject(petName);
        if (petObject.canGhost() ?
                !SpringUtils.getPetService().isEquippedGhostFull(role)
                : !SpringUtils.getPetService().isEquippedFull(role)) {
            if (petObject != null) {
                Pet pet = SpringUtils.getBean(PetService.class).addPet(petObject, role, false);
                SpringUtils.getBean(PetService.class).loadPet(role, pet);
            }
        } else {
            MessagePusher.pushMessage(role, new RespMsg("当前宠物包裹已满，请整理后再来吧。"));
        }
    }

    public void jifen(Role role, int score) {
        SpringUtils.getRoleService().addRechargeScore(role, score);
    }

    public void choujiang(Role role, int score) {
        SpringUtils.getBean(PayService.class).choujiang(role, score);
    }

    public void yd(Role role, int score) {
        SpringUtils.getRoleService().yinde(role, score);
    }


    public void equip(Role role, String name) {
        SpringUtils.getBean(EquipService.class).getEquip(role, name);
    }

    public void banggong(Role role, int value) {
        SpringUtils.getBean(PartyService.class).addContrib(role, value);
    }

    public void reloadAll(Role role, String tableName) {
        SpringUtils.getBean(MyApplicationRunner.class).initTotal();
    }

    public void stopServer(Role role, int aa) {
        Runtime.getRuntime().exit(0);
    }

    /**
     * {"混元金斗", "番天印","阴阳镜","定海珠","金蛟剪","九龙神火罩","卸甲金葫"};
     */
    public void fabao(Role role, String name) {
        SpringUtils.getBean(EquipService.class).getArtifact(name, role);
    }

    public void fabao18(Role role, String name) {
        SpringUtils.getBean(FabaoService.class).getArtifact18(role, name, 1);
    }

    public void fabao24(Role role, String name) {
        SpringUtils.getBean(FabaoService.class).getArtifact24(role, name, 1);
    }

    public void online(Role role, String name) {
        MessagePusher.pushMessage(role, new RespNotifyMiscEx("在线人数为#R" + DataCache.ONLINE_ROLES.size() + "#n!!"));
    }

    /**
     * 设置扶持号
     */
    public void fuchi(Role role, int i) {
        if (i == 1) {
            role.setBanTrade(true);
            MessagePusher.pushMessage(role, new RespNotifyMiscEx("设置扶持号成功，将#R会限制#n集市珍宝交易！！！"));
        } else {
            role.setBanTrade(false);
            MessagePusher.pushMessage(role, new RespNotifyMiscEx("取消扶持号成功，将#R不会限制#n集市珍宝交易！！！"));
        }
        role.save();
    }

    /**
     * 查看玩家counter
     */
    public void counter(Role role, int i) {
//        IoSession session = SessionUtils.getSession(role.getRoleId());
//        String counterMsg = ModuleCounterFilter.getCounter(session).toString();
//        MessagePusher.pushMessage(role, new RespNotifyMiscEx(counterMsg));
//        log.error("[MODULE_COUNTER] GM查看 [{}] Module Counter: {}", role.getName(), counterMsg);
    }

    /**
     * 查看所有
     */
    public void allCounter(Role role, int i) {
//        if (i == 1) {
//            ModuleCounterFilter.dumpAll();
//        } else {
//            ModuleCounterFilter.dumpUnchecked();
//        }
//
//        MessagePusher.pushMessage(role, new RespNotifyMiscEx("打印成功, 请到日志中查看!"));
    }


    /**
     * 设置权限好
     */
    public void quanxian(Role role, int value) {
        Account account = SpringUtils.getBean(AccountService.class).getAccount(role.getSid());
        if (account == null) {
            return;
        }
        if (value == 200) {
            account.setPrivilege((short) 200);
        } else {
            account.setPrivilege((short) 0);
        }
        SpringUtils.getBean(AccountService.class).addAccount(account);
    }

    public void daohang(Role role, int daohang) {
        SpringUtils.getBean(RoleService.class).addTao(role, daohang);
    }

    /**
     * 跨服登录
     *
     * @param role
     */
    public void cross(Role role) {
        if (SpringUtils.getBean(CrossServerConfig.class).isCenterServer()) {
            SpringUtils.getBean(CrossService.class).backGameServer(role);
        } else {
            SpringUtils.getBean(PlayerNativeTransferService.class).beginTransfer(role);
        }

    }

    public void zhuangbei(Role role, int level) {
        EquipService equipService = SpringUtils.getBean(EquipService.class);
        if (level > 0 && level <= 170) {
            BagService bagService = SpringUtils.getBean(BagService.class);
            short pos = bagService.getPos(role, false);
            if (pos >= 41) {
                equipService.getNotIdentifyEquip(level, role, pos);
            }
        }
    }

    public void jifenAll(Role role, int score) {
        Map<Long, IoSession> map = SpringUtils.getBean(GameServer.class).getAcceptor().getManagedSessions();
        for (Map.Entry<Long, IoSession> entry : map.entrySet()) {
            IoSession session = entry.getValue();
            Role tempRole = SessionUtils.getRoleBySession(session);
            if (tempRole == null) {
                continue;
            }
            jifen(tempRole, score);
        }
    }

    public void yinyuanbaoAll(Role role, int score) {
        RoleService roleService = SpringUtils.getRoleService();
        Map<Long, IoSession> map = SpringUtils.getBean(GameServer.class).getAcceptor().getManagedSessions();
        for (Map.Entry<Long, IoSession> entry : map.entrySet()) {
            IoSession session = entry.getValue();
            Role tempRole = SessionUtils.getRoleBySession(session);
            if (tempRole == null) {
                continue;
            }
            roleService.addSiver(tempRole,score,Reason.AGENT_GM);
        }
    }

    public void jinyuanbaoAll(Role role, int score) {
        RoleService roleService = SpringUtils.getRoleService();
        Map<Long, IoSession> map = SpringUtils.getBean(GameServer.class).getAcceptor().getManagedSessions();
        for (Map.Entry<Long, IoSession> entry : map.entrySet()) {
            IoSession session = entry.getValue();
            Role tempRole = SessionUtils.getRoleBySession(session);
            if (tempRole == null) {
                continue;
            }
            roleService.addGold(tempRole, score, Reason.AGENT_GM);
        }
    }

    public void choujiangAll(Role role, int value) {
        Map<Long, IoSession> map = SpringUtils.getBean(GameServer.class).getAcceptor().getManagedSessions();
        for (Map.Entry<Long, IoSession> entry : map.entrySet()) {
            IoSession session = entry.getValue();
            Role tempRole = SessionUtils.getRoleBySession(session);
            if (tempRole == null) {
                continue;
            }
            choujiang(tempRole, value);
        }
    }

    public void shoushi(Role role, String name) {
        EquipService equipService = SpringUtils.getBean(EquipService.class);
        BagService bagService = SpringUtils.getBean(BagService.class);
        short pos = bagService.getPos(role, false);
        if (pos >= 41) {
            equipService.getJewelry(role, name, false, 1, true);
        }
    }

    public void shoushiX5(Role role, String name) {
        EquipService equipService = SpringUtils.getBean(EquipService.class);
        BagService bagService = SpringUtils.getBean(BagService.class);
        short pos = bagService.getPos(role, false);
        if (pos >= 41) {
            equipService.getJewelry(role, name, true, 1, true);
        }
    }

/*    public void gonggao(Role role, String content) {
        Account account = SpringUtils.getBean(AccountService.class).getAccount(role.getSid());
        if (account.getPrivilege() < PrivilegeConst.GM) {
            return;
        }
        SpringUtils.getBean(ChatService.class).sendAdnotice(content.split("==")[1]);
    }*/

    //        if (reqChat.getMsg().contains("天星石-")) {
//            int num = Integer.parseInt(reqChat.getMsg().split("-")[1]);
//            SpringUtils.getBean(EquipService.class).addMall("天星石", false, role, num);
//        }
//
//        if (reqChat.getMsg().contains("女娲石-")) {
//            int num = Integer.parseInt(reqChat.getMsg().split("-")[1]);
//            SpringUtils.getBean(EquipService.class).addMall("超级女娲石", false, role, num);
//        }

    public void quitMY(Role role, String aa) {
        FightService fightService = SpringUtils.getBean(FightService.class);
        Fight fight = fightService.getFightByRoleId(role.getRoleId());
        if (fight == null) {
            return;
        }
        fightService.quitFight(fight);
    }

    public void bangpai(Role role, String name) {
        String[] names = name.split("##");
        Dao dao = SpringUtils.getBean(Dao.class);
        Party party = dao.fetch(Party.class, Cnd.where("partyName", "=", names[0]));
        if (party == null) {
            MessagePusher.pushMessage(role, new RespNotifyMiscEx("帮派不存在"));
            return;
        }
        PartyService partyService = SpringUtils.getPartyService();
        party = partyService.getParty(party.getId());
        party.setPartyName(names[1]);
        party.setNotice(names[1]);
        party.save();
        MessagePusher.pushMessage(role, new RespNotifyMiscEx("修改成功！！！"));
    }

    public void shoushiXX5(Role role,String content){
        SpringUtils.getEquipService().getJewelryNew(role, content.substring(0,4), 1, content,false);
    }

    public void hunqi(Role role,String content){
        SpringUtils.getBean(EquipHunQiFenHuaHandler.class).addHunqi(role,content);
    }
    
    public void title(Role role, String  content) {
//      String[] params = content.split("##");
      TitleInfo titleInfo = new TitleInfo();
      titleInfo.setType(content);
      titleInfo.setTitle(content);
      SpringUtils.getRoleService().addTitle(role, titleInfo);
  }

    public void hunqimanshuxing(Role role,String msg){


        String hunqiname = "魂器·灵咒";
        String content = "" ;

        if(msg.equals("sudu")){
            content = hunqiname + "(敏捷=气血##敏捷=气血##敏捷=气血##敏捷=气血##敏捷=气血)" ;
        }else if(msg.equals("wuli")){
            content = hunqiname + "(力量=气血##力量=气血##力量=气血##力量=气血##力量=气血)" ;
        }else if(msg.equals("fasu")){
            content = hunqiname + "(灵力=气血##灵力=气血##灵力=气血##灵力=气血##灵力=气血)" ;

        }else {
            content = hunqiname + "(速度=气血##速度=气血##速度=气血##速度=气血##速度=气血)" ;
        }

        SpringUtils.getBean(EquipHunQiFenHuaHandler.class).addHunqi(role ,content); ;

    }


    // 新增道具指令，content:天星石=10，使用金元宝表示不限制
    public void wupin(Role role, String content) {
        String itemName = content.split("=")[100];
        int itemNum = Integer.valueOf(content.split("=")[1]);
        SpecialItem specialItem = MallDataPool.name2SpecialItem.get(itemName);


        RoleEquip roleEquip = new RoleEquip();
        roleEquip.setId(SpringUtils.getIdentityService().getNextId(IdentityType.ROLE_EQUIP));
        roleEquip.setRoleId(role.getRoleId());
        short pos = SpringUtils.getBean(BagService.class).getPos(role, false);
        roleEquip.setPosition(pos);
        roleEquip.setName(itemName);
        roleEquip.setFields(new LinkedHashMap());
        roleEquip.setType("飞行法宝");

        RoleEquipField roleEquipField = new RoleEquipField();
        roleEquipField.setType((short)1);
        roleEquipField.setField(new LinkedHashMap());
        roleEquip.getFields().put(roleEquipField.getType(), roleEquipField);
        // 填充字段

        roleEquipField.getField().put((short)40, new FiedValue(40, specialItem.getIcon())); //icon
        roleEquipField.getField().put((short)41, new FiedValue(7, 8)); // type
        roleEquipField.getField().put((short)206, new FiedValue(206, 500));
        roleEquipField.getField().put((short)74, new FiedValue(74, 34)); // item_type
        roleEquipField.getField().put((short)202, new FiedValue(202, 21)); // equip_type
        roleEquipField.getField().put((short)283, new FiedValue(283, 1)); // open_nimbus开启启灵
        roleEquipField.getField().put((short)282, new FiedValue(282, 2)); // combined
        roleEquipField.getField().put((short)1, new FiedValue(1, itemName)); // name
        roleEquipField.getField().put((short)209, new FiedValue(209, "金色"));
        roleEquipField.getField().put((short)84, new FiedValue(84, roleEquip.getId()));
        roleEquipField.getField().put((short)306, new FiedValue(306, String.valueOf(roleEquip.getId()))); //iid_str
        roleEquipField.getField().put((short)270, new FiedValue(270, 0));
        roleEquipField.getField().put((short)203, new FiedValue(203, 1));






        SpringUtils.getEquipService().add(role, roleEquip);
//        SpringUtils.getEquipService().refreshRoleEquip(role, roleEquip);
        ArrayList<RoleEquip> roleEquips = new ArrayList<>();
        roleEquips.add(roleEquip);
        RespFlyInfo respFlyInfo = SpringUtils.getBean(EquipService.class).getFlyInfo(roleEquips);
        MessagePusher.pushMessage(role, respFlyInfo);

//        RespFlyArtifactMake respFlyArtifactMake = new RespFlyArtifactMake();
//        respFlyArtifactMake.setIs_ok(1);
//        respFlyArtifactMake.setItem_name(itemName);
//        MessagePusher.pushMessage(role, respFlyArtifactMake);

//        RespFlyInfo respFlyInfo = new RespFlyInfo();
//        ArrayList<EquipInfo> equipInfos = new ArrayList<>();
//        equipInfos.add
//        respFlyInfo.setList(equipInfos);


//        OnlineMall onlineMall = new OnlineMall();
//        onlineMall.setName(itemName);
//        onlineMall.setItemtype((short) 34);
//        onlineMall.setType(500);
//        SpringUtils.getBean(BagService.class).addRoleEquip(role, true, 1, onlineMall);
//        SpringUtils.getEquipService().addMall(itemName, true, role, itemNum);
    }

    public void hunqiaomanshuxing(Role role,String msg){


        if(msg.equals("sudu")){
            String content1 ="所有属性##18##敏捷##31##敏捷##31" ;
            hunqiao(role,content1);
        }else if(msg.equals("wuli")){
            String content2 ="所有属性##18##力量##31##力量##31" ;
            hunqiao(role,content2);
        }else if(msg.equals("fasu")){
            String content3 ="所有属性##18##灵力##31##灵力##31" ;
            hunqiao(role,content3);

        }else {
            String content1 ="速度##282##速度##282##速度##282" ;
            hunqiao(role,content1);
        }


    }




    public void hunqiao(Role role ,String content){

        String[] shuxingvalues = content.split("##");

        HunQiaoService hunQiaoService = SpringUtils.getBean(HunQiaoService.class);

        HunQiaoCangKu hunQiaoCangKu = new HunQiaoCangKu();
        HunQiaoToSave hunQiaoToSave = hunQiaoService.hunQiaoToSave(role.getRoleId());
        //仓库类别
        hunQiaoCangKu.setStr("tyzq_store");
        List<HunQiaoStoreEquipInfo> list = new ArrayList<>();
        if(!hunQiaoService.hasPosition(role,1,hunQiaoToSave)){//这个前端限死了，但是后端还是加上吧
            MessagePusher.pushMessage(role,new RespMsg("仓库空间不足"));
            return;
        }

        HunQiaoStoreEquipInfo hunQiaoStoreEquipInfo = new HunQiaoStoreEquipInfo();
        //位置相同会覆盖
        short pos = hunQiaoService.newPosition(hunQiaoToSave);
        hunQiaoStoreEquipInfo.setPos(pos);

        List<EquipField> equipFields = new ArrayList<>();

        List<HunQiaoField> list_hunqiao = null ;
        if(shuxingvalues.length == 2 ){
            list_hunqiao = hunQiaoService.getField(shuxingvalues[0] ,Integer.parseInt(shuxingvalues[1] ) ,"" ,0,"" ,0 ) ;
        }else if(shuxingvalues.length == 4 ){
            list_hunqiao = hunQiaoService.getField(shuxingvalues[0] ,Integer.parseInt(shuxingvalues[1] ) ,shuxingvalues[2] ,Integer.parseInt(shuxingvalues[3] ),"" ,0 ) ;
        }else if(shuxingvalues.length == 6 ){
            list_hunqiao = hunQiaoService.getField(shuxingvalues[0] ,Integer.parseInt(shuxingvalues[1] ) ,shuxingvalues[2] ,Integer.parseInt(shuxingvalues[3] ),shuxingvalues[4] ,Integer.parseInt(shuxingvalues[5] ) ) ;
        }

        HunQiaoColorEnum hunQiaoColorEnum = null ;
        if(list_hunqiao.size() ==1 ){
            hunQiaoColorEnum = HunQiaoColorEnum.BLUE ;
        }else if(list_hunqiao.size() == 2 ){
            hunQiaoColorEnum = HunQiaoColorEnum.PINK ;
        }else if(list_hunqiao.size() == 3 ){
            hunQiaoColorEnum = HunQiaoColorEnum.GOLD ;
        }else {
            hunQiaoColorEnum = HunQiaoColorEnum.BLUE ;
        }

        //根据颜色组装equipField ，加入equipFields 列表
        equipFields.add(hunQiaoService.genEquipField(hunQiaoColorEnum,hunQiaoToSave));

        hunQiaoStoreEquipInfo.setEquipFields(equipFields,list_hunqiao );

        //组合参数，发包
        list.add(hunQiaoStoreEquipInfo);
        hunQiaoCangKu.setList(list);


        //加一阶引魂阶段
        hunQiaoService.addHunQiaoLevel(hunQiaoToSave);
        //拼好参数，入库
        List<HunQiaoStoreEquipInfo> hunQiaoStoreEquipInfos = hunQiaoCangKu.getList();
        hunQiaoToSave.getCangKus().addAll(hunQiaoStoreEquipInfos);
        hunQiaoService.update(role.getRoleId(),hunQiaoToSave);

        hunQiaoCangKu.addMore();
        MessagePusher.pushMessage(role,hunQiaoCangKu );

        role.save();
    }
    
}
